<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jstl/core"
	xmlns:tt="https://code.google.com/p/rad-framework/pdf"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:p="http://jboss.com/products/seam/pdf"
	template="report-template.xhtml">
	
	<ui:param name="orientation" value="#{columnTypes.size > 5 ? 'landscape' : 'portrait'}" />
	
	<ui:define name="body">
		<ui:insert name="chartSection">
			<p:chapter number="1" numberDepth="0">
				<p:title>
					<p:paragraph alignment="left">#{messages['Charts']}</p:paragraph>
				</p:title>
				<ui:insert name="charts"/>
			</p:chapter>
		</ui:insert>
		<p:chapter number="2" numberDepth="0">
			<p:title>
				<p:paragraph alignment="left">#{messages['Table']}</p:paragraph>
			</p:title>
			<p:table columns="#{columns != null ? columns : columnTypes.size}" headerRows="1">
				<f:facet name="defaultCell">
					<p:cell horizontalAlignment="left"
						verticalAlignment="top"/>
				</f:facet>

				<ui:insert name="headers">
					<c:forEach items="#{columnTypes}" var="c">
						<tt:header-cell 
							label="#{c.label}"
							rendered="#{c.rendered}" />
					</c:forEach>
				</ui:insert>
				
				<ui:repeat value="#{result}" var="row">
					<ui:insert name="columns">
						<c:forEach items="#{columnTypes}" var="c">
							<tt:column-cell
								type="#{c.type}" 
								value="#{c.value}"
								rendered="#{c.rendered}" />
						</c:forEach>
					</ui:insert>
				</ui:repeat>
			</p:table>
		</p:chapter>
	</ui:define>
</ui:composition>
